'use strict';
module.exports = (app) => {
  const { STRING, INTEGER, TEXT } = app.Sequelize;
  const CarouselGroup = app.model.define('w_carouselGroup', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    name: {
      comment: '分组名',
      type: TEXT('long'),
      allowNull: false,
    },
    adminId: {
      comment: '管理员id',
      type: INTEGER,
      allowNull: false,
    },
    projectId: {
      comment: '项目id',
      type: INTEGER,
      allowNull: false,
    },
  });
  //关联轮播图表
  CarouselGroup.associate = function () {
    app.model.Tables.Web.CarouselGroup.hasMany(app.model.Tables.Web.Carousel, {
      foreignKey: 'carouselGroupId',
    });
  };
  return CarouselGroup;
};
